home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 1995 May / PC Answers CD-ROM 7 (Future Publishing) (May 1995).iso / vbits / demos / afd / postcode / pc-vb3 / pctest.frm (.txt) next >
Encoding:
Visual Basic Form  |  1995-01-04  |  7.6 KB  |  253 lines

  1. VERSION 2.00
  2. Begin Form PTest 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "AFD Postcode: Sample VB program"
  5.    ClientHeight    =   3945
  6.    ClientLeft      =   1080
  7.    ClientTop       =   1545
  8.    ClientWidth     =   7365
  9.    Height          =   4350
  10.    Left            =   1020
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   3945
  13.    ScaleWidth      =   7365
  14.    Top             =   1200
  15.    Width           =   7485
  16.    Begin CommandButton Command1 
  17.       BackColor       =   &H00C0C0C0&
  18.       Caption         =   "E&xit"
  19.       Height          =   435
  20.       Left            =   5310
  21.       TabIndex        =   16
  22.       Top             =   2460
  23.       Width           =   960
  24.    End
  25.    Begin TextBox FBox 
  26.       Height          =   285
  27.       Index           =   6
  28.       Left            =   1905
  29.       TabIndex        =   6
  30.       Text            =   "STD Code"
  31.       Top             =   2760
  32.       Width           =   1485
  33.    End
  34.    Begin TextBox FBox 
  35.       Height          =   285
  36.       Index           =   5
  37.       Left            =   1905
  38.       TabIndex        =   5
  39.       Text            =   "County"
  40.       Top             =   2400
  41.       Width           =   2520
  42.    End
  43.    Begin TextBox FBox 
  44.       Height          =   285
  45.       Index           =   4
  46.       Left            =   1905
  47.       TabIndex        =   4
  48.       Text            =   "Town"
  49.       Top             =   2040
  50.       Width           =   2520
  51.    End
  52.    Begin TextBox FBox 
  53.       Height          =   285
  54.       Index           =   3
  55.       Left            =   1905
  56.       TabIndex        =   3
  57.       Text            =   "Street"
  58.       Top             =   1680
  59.       Width           =   2520
  60.    End
  61.    Begin TextBox FBox 
  62.       Height          =   285
  63.       Index           =   2
  64.       Left            =   1905
  65.       TabIndex        =   2
  66.       Text            =   "FirstLine"
  67.       Top             =   1320
  68.       Width           =   2520
  69.    End
  70.    Begin TextBox FBox 
  71.       Height          =   285
  72.       Index           =   1
  73.       Left            =   1905
  74.       TabIndex        =   1
  75.       Text            =   "Name"
  76.       Top             =   930
  77.       Width           =   2520
  78.    End
  79.    Begin TextBox FBox 
  80.       Height          =   285
  81.       Index           =   0
  82.       Left            =   1905
  83.       LinkItem        =   "TestFrm"
  84.       LinkTopic       =   "POSTCODE|PCFILl"
  85.       TabIndex        =   0
  86.       Text            =   "Postcode"
  87.       Top             =   585
  88.       Width           =   1485
  89.    End
  90.    Begin Label Label2 
  91.       AutoSize        =   -1  'True
  92.       BackColor       =   &H00C0C0C0&
  93.       Caption         =   "Enter a postcode in the POSTCODE field (try B1 1AA) and press enter. AFD's POSTCODE will return the Street, Town, County and dialing Code into the appropriate fields"
  94.       FontBold        =   0   'False
  95.       FontItalic      =   0   'False
  96.       FontName        =   "MS Sans Serif"
  97.       FontSize        =   8.25
  98.       FontStrikethru  =   0   'False
  99.       FontUnderline   =   0   'False
  100.       Height          =   1170
  101.       Left            =   4740
  102.       TabIndex        =   14
  103.       Top             =   1065
  104.       Width           =   2355
  105.       WordWrap        =   -1  'True
  106.    End
  107.    Begin Label Label1 
  108.       Alignment       =   1  'Right Justify
  109.       BackStyle       =   0  'Transparent
  110.       Caption         =   "Telephone"
  111.       Height          =   285
  112.       Index           =   6
  113.       Left            =   360
  114.       TabIndex        =   13
  115.       Top             =   2760
  116.       Width           =   1365
  117.    End
  118.    Begin Label Label1 
  119.       Alignment       =   1  'Right Justify
  120.       BackStyle       =   0  'Transparent
  121.       Caption         =   "County"
  122.       Height          =   285
  123.       Index           =   5
  124.       Left            =   360
  125.       TabIndex        =   12
  126.       Top             =   2400
  127.       Width           =   1365
  128.    End
  129.    Begin Label Label1 
  130.       Alignment       =   1  'Right Justify
  131.       BackStyle       =   0  'Transparent
  132.       Caption         =   "Town"
  133.       Height          =   285
  134.       Index           =   4
  135.       Left            =   360
  136.       TabIndex        =   11
  137.       Top             =   2040
  138.       Width           =   1365
  139.    End
  140.    Begin Label Label1 
  141.       Alignment       =   1  'Right Justify
  142.       BackStyle       =   0  'Transparent
  143.       Caption         =   "Street"
  144.       Height          =   285
  145.       Index           =   3
  146.       Left            =   360
  147.       TabIndex        =   10
  148.       Top             =   1680
  149.       Width           =   1365
  150.    End
  151.    Begin Label Label1 
  152.       Alignment       =   1  'Right Justify
  153.       BackStyle       =   0  'Transparent
  154.       Caption         =   "FirstLine"
  155.       Height          =   285
  156.       Index           =   2
  157.       Left            =   360
  158.       TabIndex        =   9
  159.       Top             =   1320
  160.       Width           =   1365
  161.    End
  162.    Begin Label Label1 
  163.       Alignment       =   1  'Right Justify
  164.       BackStyle       =   0  'Transparent
  165.       Caption         =   "Name"
  166.       Height          =   285
  167.       Index           =   1
  168.       Left            =   360
  169.       TabIndex        =   8
  170.       Top             =   930
  171.       Width           =   1365
  172.    End
  173.    Begin Label Label1 
  174.       Alignment       =   1  'Right Justify
  175.       BackStyle       =   0  'Transparent
  176.       Caption         =   "Post Code"
  177.       Height          =   285
  178.       Index           =   0
  179.       Left            =   360
  180.       TabIndex        =   7
  181.       Top             =   585
  182.       Width           =   1365
  183.    End
  184.    Begin Label Label3 
  185.       BackColor       =   &H00C0C0C0&
  186.       BorderStyle     =   1  'Fixed Single
  187.       Height          =   1350
  188.       Left            =   4665
  189.       TabIndex        =   15
  190.       Top             =   975
  191.       Width           =   2475
  192.    End
  193. Sub Command1_Click ()
  194. Unload Me
  195. End Sub
  196. Sub DoDDE ()
  197. On Error GoTo DDE_ERROR
  198. ' Initialise a link to Postcode
  199. ' and send it some data
  200.     FBox(0).LinkMode = 0
  201.     FBox(0).LinkTopic = "POSTCODE|PCFILL"
  202.     FBox(0).LinkItem = "POSTCODE"
  203.     FBox(0).LinkMode = 2
  204.     FBox(0).LinkPoke
  205. ' Request the data for the other fields
  206.     FBox(3).LinkTopic = "POSTCODE|PCFILL"
  207.     FBox(3).LinkItem = "Street"
  208.     FBox(3).LinkMode = 2
  209.     FBox(3).LinkRequest
  210.     FBox(4).LinkTopic = "POSTCODE|PCFILL"
  211.     FBox(4).LinkItem = "Town"
  212.     FBox(4).LinkMode = 2
  213.     FBox(4).LinkRequest
  214.     FBox(5).LinkTopic = "POSTCODE|PCFILL"
  215.     FBox(5).LinkItem = "County"
  216.     FBox(5).LinkMode = 2
  217.     FBox(5).LinkRequest
  218.     FBox(6).LinkTopic = "POSTCODE|PCFILL"
  219.     FBox(6).LinkItem = "STD"
  220.     FBox(6).LinkMode = 2
  221.     FBox(6).LinkRequest
  222.     FBox(1).SetFocus
  223.     Exit Sub
  224. DDE_ERROR:
  225. MsgBox "You must have postcode running before attempting to link to it.  Please run POSTCODE and re try this example. "
  226. Exit Sub
  227. End Sub
  228. Sub FBox_Change (Index As Integer)
  229. If Index = 0 Then
  230.     FBox(Index).Text = UCase(FBox(Index).Text)
  231.     FBox(Index).SelStart = Len(FBox(Index).Text)
  232. End If
  233. End Sub
  234. Sub FBox_KeyPress (Index As Integer, KeyAscii As Integer)
  235. If KeyAscii = 13 Then
  236.     If Index = 0 Then
  237.                 FBox(Index + 1).SetFocus
  238.                 FBox(Index + 1).SelLength = Len(FBox(Index + 1).Text)
  239.                 
  240.                 DoDDE
  241.     Else
  242.         Select Case Index
  243.             Case 1 To 5
  244.                 FBox(Index + 1).SetFocus
  245.                 FBox(Index + 1).SelLength = Len(FBox(Index + 1).Text)
  246.         End Select
  247.     End If
  248. End If
  249. End Sub
  250. Sub Form_Load ()
  251. FBox(0).SelLength = Len(FBox(0).Text)
  252. End Sub
  253.